import request from '@/utils/request';
import { AxiosPromise } from 'axios';

/**
 * 查询库存盘点列表
 * @param query
 * @returns {*}
 */

export const listStockCheck = (query?: StockCheckVO): AxiosPromise<StockCheckVO[]> => {
  return request({
    url: '/wms/stockCheck/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询库存盘点子表
 * @param query
 * @returns {*}
 */
export const listStockCheckLine = (query?: StockCheckLineVO): AxiosPromise<StockCheckLineVO[]> => {
  return request({
    url: '/wms/stockCheck/lineList',
    method: 'get',
    params: query
  });
};
/**
 * 删除库存盘点子表
 * @param lineId
 */
export const delStockCheckLine = (lineId: number | string) => {
  return request({
    url: '/wms/stockCheck/delLineList/' + lineId,
    method: 'delete',
  });
};

/**
 * 查询库存盘点详细
 * @param id
 */
export const getStockCheck = (id: number): AxiosPromise<StockCheckVO> => {
  return request({
    url: '/wms/stockCheck/' + id,
    method: 'get'
  });
};

/**
 * 新增库存盘点
 * @param data
 */
export const addStockCheck = (data: StockCheckVO) => {
  return request({
    url: '/wms/stockCheck',
    method: 'post',
    data: data
  });
};

/**
 * 修改库存盘点
 * @param data
 */
export const updateStockCheck = (data: StockCheckVO) => {
  return request({
    url: '/wms/stockCheck',
    method: 'put',
    data: data
  });
};

/**
 * 删除库存盘点
 * @param id
 */
export const delStockCheck = (id: string | number | (string | number | undefined)[]) => {
  return request({
    url: '/wms/stockCheck/' + id,
    method: 'delete'
  });
};

export interface StockCheckVO extends BaseEntity, PageQuery {
    /** 事务 */
    id?: string | number;

    /** 事务 */
    name?: string;

    /** 仓库 */
    warehouseId?: number;

    /** 仓库 */
    wareName?: string;

    /** 盘点人 */
    userId?: string | number;

    /** 状态 */
    status?: string;

    /** 备注 */
    remark?: string;

    /** 用户名 */
    nickName?: string;

    line?: StockCheckLineVO[];
}
export interface StockCheckLineVO extends BaseEntity, PageQuery {
  /** 盘点单ID */
  id?: string | number;

  /** ID */
  lineId?: number;

  /** 物品 */
  productId?: string | number;

  /** 单位 */
  measureUnit?: string;

  /** 批次号 */
  batchCode?: string;

  /** 仓库 */
  warehouseId?: string | number;

  /** 库位 */
  areaId?: number;

  /** 供应商 */
  supplierId?: number;

  /** 生产厂商 */
  manufacturerId?: number;

  /** 盘点前数量 */
  beforeQuantity?: number;

  /** 有效期 */
  expireDate?: string;

  /** 备注 */
  remark?: string;

  /** 产品名 */
  productName?: string;

  /** 盘点数量 */
  checkQuantity?: number;


}
